﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace Demo1
{




    public class Quest : IEnumerable
    {
        Player _Owner;


        public Quest(Player Owner)
        {
            _Owner = Owner;
        }

        public IEnumerator GetEnumerator()
        {


            Console.WriteLine("pc start Attack({0},{1})", _Owner._ID, 3);

            yield return new conTimer(3);

            Console.WriteLine("Test collision");

            MapHandle mapHandle = MapManager.I.CollisionCheck(_Owner._MapHandle);

            if (mapHandle != null)
            {


                Console.WriteLine("collision({0}->{1})", _Owner._ID, mapHandle._ID);
            }


            yield break;
        }

        public bool CheckRange(int x, int y, int sx, int sy)
        {

            return true;
        }

    }

    public class Skill : IEnumerable
    {
        Player _Owner;


        public Skill(Player Owner)
        {
            _Owner = Owner;
        }

        public IEnumerator GetEnumerator()
        {


            Console.WriteLine("pc start Attack({0},{1})", _Owner._ID, 3);

            yield return new conTimer(3);

            Console.WriteLine("Test collision");

            MapHandle mapHandle = MapManager.I.CollisionCheck(_Owner._MapHandle);

            if (mapHandle != null)
            {


                Console.WriteLine("collision({0}->{1})",_Owner._ID,mapHandle._ID);
            }
            

            yield break;
        }

        public bool CheckRange(int x, int y, int sx, int sy)
        {

            return true;
        }

    }


    public class Move : IEnumerable
    {
        //int m_PCID;

        double _DestX, _DestY;

        Player _Owner;


        public Move(Player Owner, double x,double y)
        {
            _DestX = x;
            _DestY = y;
            _Owner = Owner;
        }

        public IEnumerator GetEnumerator()
        {


            yield return new conTimer(1);

            MapManager.I.MoveTo(_Owner._MapHandle, _DestX, _DestY);

            yield break;
        }

        public bool CheckRange(int x, int y, int sx, int sy)
        {

            return true;
        }

    }

}
